﻿///////////////////////////////////////////////////////////////
// This is generated code. 
//////////////////////////////////////////////////////////////
// Code is generated using LLBLGen Pro version: 3.1
// Code is generated on: 2012年10月10日 8:11:49
// Code is generated using templates: SD.TemplateBindings.SharedTemplates.NET20
// Templates vendor: Solutions Design.
// Templates version: 
//////////////////////////////////////////////////////////////
using System;
using System.ComponentModel;
using System.Collections.Generic;
using System.Collections;
#if !CF
using System.Runtime.Serialization;
#endif
using System.Data;
using System.Xml.Serialization;
using NetDon.eBoss.Data;
using NetDon.eBoss.Data.FactoryClasses;
using NetDon.eBoss.Data.DaoClasses;
using NetDon.eBoss.Data.RelationClasses;
using NetDon.eBoss.Data.HelperClasses;
using NetDon.eBoss.Data.CollectionClasses;

using SD.LLBLGen.Pro.ORMSupportClasses;

namespace NetDon.eBoss.Data.EntityClasses
{
	
	// __LLBLGENPRO_USER_CODE_REGION_START AdditionalNamespaces
	// __LLBLGENPRO_USER_CODE_REGION_END

	/// <summary>Entity class which represents the entity 'Productgroup'. <br/><br/>
	/// 
	/// </summary>
	[Serializable]
	public partial class ProductgroupEntity : CommonEntityBase
		// __LLBLGENPRO_USER_CODE_REGION_START AdditionalInterfaces
		// __LLBLGENPRO_USER_CODE_REGION_END	
	{
		#region Class Member Declarations
		private HtmltoolaccountEntity _htmltoolaccount;
		private bool	_alwaysFetchHtmltoolaccount, _alreadyFetchedHtmltoolaccount, _htmltoolaccountReturnsNewIfNotFound;
		private HtmltoolcategoryruleEntity _htmltoolcategoryrule;
		private bool	_alwaysFetchHtmltoolcategoryrule, _alreadyFetchedHtmltoolcategoryrule, _htmltoolcategoryruleReturnsNewIfNotFound;
		private HtmltoolstyleEntity _htmltoolstyle;
		private bool	_alwaysFetchHtmltoolstyle, _alreadyFetchedHtmltoolstyle, _htmltoolstyleReturnsNewIfNotFound;
		private HtmltooltrademarksettingEntity _htmltooltrademarksetting;
		private bool	_alwaysFetchHtmltooltrademarksetting, _alreadyFetchedHtmltooltrademarksetting, _htmltooltrademarksettingReturnsNewIfNotFound;
		private TitlesettingEntity _titlesetting;
		private bool	_alwaysFetchTitlesetting, _alreadyFetchedTitlesetting, _titlesettingReturnsNewIfNotFound;

		// __LLBLGENPRO_USER_CODE_REGION_START PrivateMembers
		// __LLBLGENPRO_USER_CODE_REGION_END
		#endregion

		#region Statics
		private static Dictionary<string, string>	_customProperties;
		private static Dictionary<string, Dictionary<string, string>>	_fieldsCustomProperties;

		/// <summary>All names of fields mapped onto a relation. Usable for in-memory filtering</summary>
		public static partial class MemberNames
		{
			/// <summary>Member name Htmltoolaccount</summary>
			public static readonly string Htmltoolaccount = "Htmltoolaccount";
			/// <summary>Member name Htmltoolcategoryrule</summary>
			public static readonly string Htmltoolcategoryrule = "Htmltoolcategoryrule";
			/// <summary>Member name Htmltoolstyle</summary>
			public static readonly string Htmltoolstyle = "Htmltoolstyle";
			/// <summary>Member name Htmltooltrademarksetting</summary>
			public static readonly string Htmltooltrademarksetting = "Htmltooltrademarksetting";
			/// <summary>Member name Titlesetting</summary>
			public static readonly string Titlesetting = "Titlesetting";
		}
		#endregion
		
		/// <summary>Static CTor for setting up custom property hashtables. Is executed before the first instance of this entity class or derived classes is constructed. </summary>
		static ProductgroupEntity()
		{
			SetupCustomPropertyHashtables();
		}

		/// <summary>CTor</summary>
		public ProductgroupEntity() : base()
		{
			InitClassEmpty(null);
		}
		
		/// <summary>CTor</summary>
		/// <param name="id">PK value for Productgroup which data should be fetched into this Productgroup object</param>
		public ProductgroupEntity(System.Int32 id)
		{
			InitClassFetch(id, null, null);
		}

		/// <summary>CTor</summary>
		/// <param name="id">PK value for Productgroup which data should be fetched into this Productgroup object</param>
		/// <param name="prefetchPathToUse">the PrefetchPath which defines the graph of objects to fetch as well</param>
		public ProductgroupEntity(System.Int32 id, IPrefetchPath prefetchPathToUse)
		{
			InitClassFetch(id, null, prefetchPathToUse);
		}

		/// <summary>CTor</summary>
		/// <param name="id">PK value for Productgroup which data should be fetched into this Productgroup object</param>
		/// <param name="validator">The custom validator object for this ProductgroupEntity</param>
		public ProductgroupEntity(System.Int32 id, IValidator validator)
		{
			InitClassFetch(id, validator, null);
		}

		/// <summary>Private CTor for deserialization</summary>
		/// <param name="info"></param>
		/// <param name="context"></param>
		protected ProductgroupEntity(SerializationInfo info, StreamingContext context) : base(info, context)
		{
			_htmltoolaccount = (HtmltoolaccountEntity)info.GetValue("_htmltoolaccount", typeof(HtmltoolaccountEntity));
			if(_htmltoolaccount!=null)
			{
				_htmltoolaccount.AfterSave+=new EventHandler(OnEntityAfterSave);
			}
			_htmltoolaccountReturnsNewIfNotFound = info.GetBoolean("_htmltoolaccountReturnsNewIfNotFound");
			_alwaysFetchHtmltoolaccount = info.GetBoolean("_alwaysFetchHtmltoolaccount");
			_alreadyFetchedHtmltoolaccount = info.GetBoolean("_alreadyFetchedHtmltoolaccount");

			_htmltoolcategoryrule = (HtmltoolcategoryruleEntity)info.GetValue("_htmltoolcategoryrule", typeof(HtmltoolcategoryruleEntity));
			if(_htmltoolcategoryrule!=null)
			{
				_htmltoolcategoryrule.AfterSave+=new EventHandler(OnEntityAfterSave);
			}
			_htmltoolcategoryruleReturnsNewIfNotFound = info.GetBoolean("_htmltoolcategoryruleReturnsNewIfNotFound");
			_alwaysFetchHtmltoolcategoryrule = info.GetBoolean("_alwaysFetchHtmltoolcategoryrule");
			_alreadyFetchedHtmltoolcategoryrule = info.GetBoolean("_alreadyFetchedHtmltoolcategoryrule");

			_htmltoolstyle = (HtmltoolstyleEntity)info.GetValue("_htmltoolstyle", typeof(HtmltoolstyleEntity));
			if(_htmltoolstyle!=null)
			{
				_htmltoolstyle.AfterSave+=new EventHandler(OnEntityAfterSave);
			}
			_htmltoolstyleReturnsNewIfNotFound = info.GetBoolean("_htmltoolstyleReturnsNewIfNotFound");
			_alwaysFetchHtmltoolstyle = info.GetBoolean("_alwaysFetchHtmltoolstyle");
			_alreadyFetchedHtmltoolstyle = info.GetBoolean("_alreadyFetchedHtmltoolstyle");

			_htmltooltrademarksetting = (HtmltooltrademarksettingEntity)info.GetValue("_htmltooltrademarksetting", typeof(HtmltooltrademarksettingEntity));
			if(_htmltooltrademarksetting!=null)
			{
				_htmltooltrademarksetting.AfterSave+=new EventHandler(OnEntityAfterSave);
			}
			_htmltooltrademarksettingReturnsNewIfNotFound = info.GetBoolean("_htmltooltrademarksettingReturnsNewIfNotFound");
			_alwaysFetchHtmltooltrademarksetting = info.GetBoolean("_alwaysFetchHtmltooltrademarksetting");
			_alreadyFetchedHtmltooltrademarksetting = info.GetBoolean("_alreadyFetchedHtmltooltrademarksetting");

			_titlesetting = (TitlesettingEntity)info.GetValue("_titlesetting", typeof(TitlesettingEntity));
			if(_titlesetting!=null)
			{
				_titlesetting.AfterSave+=new EventHandler(OnEntityAfterSave);
			}
			_titlesettingReturnsNewIfNotFound = info.GetBoolean("_titlesettingReturnsNewIfNotFound");
			_alwaysFetchTitlesetting = info.GetBoolean("_alwaysFetchTitlesetting");
			_alreadyFetchedTitlesetting = info.GetBoolean("_alreadyFetchedTitlesetting");
			this.FixupDeserialization(FieldInfoProviderSingleton.GetInstance(), PersistenceInfoProviderSingleton.GetInstance());
			// __LLBLGENPRO_USER_CODE_REGION_START DeserializationConstructor
			// __LLBLGENPRO_USER_CODE_REGION_END
		}
		
		
		/// <summary>Performs the desync setup when an FK field has been changed. The entity referenced based on the FK field will be dereferenced and sync info will be removed.</summary>
		/// <param name="fieldIndex">The fieldindex.</param>
		protected override void PerformDesyncSetupFKFieldChange(int fieldIndex)
		{
			switch((ProductgroupFieldIndex)fieldIndex)
			{
				case ProductgroupFieldIndex.Accountid:
					DesetupSyncHtmltoolaccount(true, false);
					_alreadyFetchedHtmltoolaccount = false;
					break;
				case ProductgroupFieldIndex.Categoryruleid:
					DesetupSyncHtmltoolcategoryrule(true, false);
					_alreadyFetchedHtmltoolcategoryrule = false;
					break;
				case ProductgroupFieldIndex.Colorid:
					DesetupSyncTitlesetting(true, false);
					_alreadyFetchedTitlesetting = false;
					break;
				case ProductgroupFieldIndex.Styleid:
					DesetupSyncHtmltoolstyle(true, false);
					_alreadyFetchedHtmltoolstyle = false;
					break;
				case ProductgroupFieldIndex.Trademarkid:
					DesetupSyncHtmltooltrademarksetting(true, false);
					_alreadyFetchedHtmltooltrademarksetting = false;
					break;
				default:
					base.PerformDesyncSetupFKFieldChange(fieldIndex);
					break;
			}
		}

		/// <summary> Will perform post-ReadXml actions</summary>
		protected override void PostReadXmlFixups()
		{
			_alreadyFetchedHtmltoolaccount = (_htmltoolaccount != null);
			_alreadyFetchedHtmltoolcategoryrule = (_htmltoolcategoryrule != null);
			_alreadyFetchedHtmltoolstyle = (_htmltoolstyle != null);
			_alreadyFetchedHtmltooltrademarksetting = (_htmltooltrademarksetting != null);
			_alreadyFetchedTitlesetting = (_titlesetting != null);
		}
				
		/// <summary>Gets the relation objects which represent the relation the fieldName specified is mapped on. </summary>
		/// <param name="fieldName">Name of the field mapped onto the relation of which the relation objects have to be obtained.</param>
		/// <returns>RelationCollection with relation object(s) which represent the relation the field is maped on</returns>
		protected override RelationCollection GetRelationsForFieldOfType(string fieldName)
		{
			return GetRelationsForField(fieldName);
		}

		/// <summary>Gets the relation objects which represent the relation the fieldName specified is mapped on. </summary>
		/// <param name="fieldName">Name of the field mapped onto the relation of which the relation objects have to be obtained.</param>
		/// <returns>RelationCollection with relation object(s) which represent the relation the field is maped on</returns>
		internal static RelationCollection GetRelationsForField(string fieldName)
		{
			RelationCollection toReturn = new RelationCollection();
			switch(fieldName)
			{
				case "Htmltoolaccount":
					toReturn.Add(Relations.HtmltoolaccountEntityUsingAccountid);
					break;
				case "Htmltoolcategoryrule":
					toReturn.Add(Relations.HtmltoolcategoryruleEntityUsingCategoryruleid);
					break;
				case "Htmltoolstyle":
					toReturn.Add(Relations.HtmltoolstyleEntityUsingStyleid);
					break;
				case "Htmltooltrademarksetting":
					toReturn.Add(Relations.HtmltooltrademarksettingEntityUsingTrademarkid);
					break;
				case "Titlesetting":
					toReturn.Add(Relations.TitlesettingEntityUsingColorid);
					break;
				default:
					break;				
			}
			return toReturn;
		}



		/// <summary> ISerializable member. Does custom serialization so event handlers do not get serialized.</summary>
		/// <param name="info"></param>
		/// <param name="context"></param>
		[EditorBrowsable(EditorBrowsableState.Never)]
		protected override void GetObjectData(SerializationInfo info, StreamingContext context)
		{
			info.AddValue("_htmltoolaccount", (!this.MarkedForDeletion?_htmltoolaccount:null));
			info.AddValue("_htmltoolaccountReturnsNewIfNotFound", _htmltoolaccountReturnsNewIfNotFound);
			info.AddValue("_alwaysFetchHtmltoolaccount", _alwaysFetchHtmltoolaccount);
			info.AddValue("_alreadyFetchedHtmltoolaccount", _alreadyFetchedHtmltoolaccount);
			info.AddValue("_htmltoolcategoryrule", (!this.MarkedForDeletion?_htmltoolcategoryrule:null));
			info.AddValue("_htmltoolcategoryruleReturnsNewIfNotFound", _htmltoolcategoryruleReturnsNewIfNotFound);
			info.AddValue("_alwaysFetchHtmltoolcategoryrule", _alwaysFetchHtmltoolcategoryrule);
			info.AddValue("_alreadyFetchedHtmltoolcategoryrule", _alreadyFetchedHtmltoolcategoryrule);
			info.AddValue("_htmltoolstyle", (!this.MarkedForDeletion?_htmltoolstyle:null));
			info.AddValue("_htmltoolstyleReturnsNewIfNotFound", _htmltoolstyleReturnsNewIfNotFound);
			info.AddValue("_alwaysFetchHtmltoolstyle", _alwaysFetchHtmltoolstyle);
			info.AddValue("_alreadyFetchedHtmltoolstyle", _alreadyFetchedHtmltoolstyle);
			info.AddValue("_htmltooltrademarksetting", (!this.MarkedForDeletion?_htmltooltrademarksetting:null));
			info.AddValue("_htmltooltrademarksettingReturnsNewIfNotFound", _htmltooltrademarksettingReturnsNewIfNotFound);
			info.AddValue("_alwaysFetchHtmltooltrademarksetting", _alwaysFetchHtmltooltrademarksetting);
			info.AddValue("_alreadyFetchedHtmltooltrademarksetting", _alreadyFetchedHtmltooltrademarksetting);
			info.AddValue("_titlesetting", (!this.MarkedForDeletion?_titlesetting:null));
			info.AddValue("_titlesettingReturnsNewIfNotFound", _titlesettingReturnsNewIfNotFound);
			info.AddValue("_alwaysFetchTitlesetting", _alwaysFetchTitlesetting);
			info.AddValue("_alreadyFetchedTitlesetting", _alreadyFetchedTitlesetting);

			// __LLBLGENPRO_USER_CODE_REGION_START GetObjectInfo
			// __LLBLGENPRO_USER_CODE_REGION_END
			base.GetObjectData(info, context);
		}
		
		/// <summary> Sets the related entity property to the entity specified. If the property is a collection, it will add the entity specified to that collection.</summary>
		/// <param name="propertyName">Name of the property.</param>
		/// <param name="entity">Entity to set as an related entity</param>
		/// <remarks>Used by prefetch path logic.</remarks>
		[EditorBrowsable(EditorBrowsableState.Never)]
		protected override void SetRelatedEntityProperty(string propertyName, IEntity entity)
		{
			switch(propertyName)
			{
				case "Htmltoolaccount":
					_alreadyFetchedHtmltoolaccount = true;
					this.Htmltoolaccount = (HtmltoolaccountEntity)entity;
					break;
				case "Htmltoolcategoryrule":
					_alreadyFetchedHtmltoolcategoryrule = true;
					this.Htmltoolcategoryrule = (HtmltoolcategoryruleEntity)entity;
					break;
				case "Htmltoolstyle":
					_alreadyFetchedHtmltoolstyle = true;
					this.Htmltoolstyle = (HtmltoolstyleEntity)entity;
					break;
				case "Htmltooltrademarksetting":
					_alreadyFetchedHtmltooltrademarksetting = true;
					this.Htmltooltrademarksetting = (HtmltooltrademarksettingEntity)entity;
					break;
				case "Titlesetting":
					_alreadyFetchedTitlesetting = true;
					this.Titlesetting = (TitlesettingEntity)entity;
					break;
				default:
					this.OnSetRelatedEntityProperty(propertyName, entity);
					break;
			}
		}

		/// <summary> Sets the internal parameter related to the fieldname passed to the instance relatedEntity. </summary>
		/// <param name="relatedEntity">Instance to set as the related entity of type entityType</param>
		/// <param name="fieldName">Name of field mapped onto the relation which resolves in the instance relatedEntity</param>
		[EditorBrowsable(EditorBrowsableState.Never)]
		protected override void SetRelatedEntity(IEntity relatedEntity, string fieldName)
		{
			switch(fieldName)
			{
				case "Htmltoolaccount":
					SetupSyncHtmltoolaccount(relatedEntity);
					break;
				case "Htmltoolcategoryrule":
					SetupSyncHtmltoolcategoryrule(relatedEntity);
					break;
				case "Htmltoolstyle":
					SetupSyncHtmltoolstyle(relatedEntity);
					break;
				case "Htmltooltrademarksetting":
					SetupSyncHtmltooltrademarksetting(relatedEntity);
					break;
				case "Titlesetting":
					SetupSyncTitlesetting(relatedEntity);
					break;
				default:
					break;
			}
		}
		
		/// <summary> Unsets the internal parameter related to the fieldname passed to the instance relatedEntity. Reverses the actions taken by SetRelatedEntity() </summary>
		/// <param name="relatedEntity">Instance to unset as the related entity of type entityType</param>
		/// <param name="fieldName">Name of field mapped onto the relation which resolves in the instance relatedEntity</param>
		/// <param name="signalRelatedEntityManyToOne">if set to true it will notify the manytoone side, if applicable.</param>
		[EditorBrowsable(EditorBrowsableState.Never)]
		protected override void UnsetRelatedEntity(IEntity relatedEntity, string fieldName, bool signalRelatedEntityManyToOne)
		{
			switch(fieldName)
			{
				case "Htmltoolaccount":
					DesetupSyncHtmltoolaccount(false, true);
					break;
				case "Htmltoolcategoryrule":
					DesetupSyncHtmltoolcategoryrule(false, true);
					break;
				case "Htmltoolstyle":
					DesetupSyncHtmltoolstyle(false, true);
					break;
				case "Htmltooltrademarksetting":
					DesetupSyncHtmltooltrademarksetting(false, true);
					break;
				case "Titlesetting":
					DesetupSyncTitlesetting(false, true);
					break;
				default:
					break;
			}
		}

		/// <summary> Gets a collection of related entities referenced by this entity which depend on this entity (this entity is the PK side of their FK fields). These entities will have to be persisted after this entity during a recursive save.</summary>
		/// <returns>Collection with 0 or more IEntity objects, referenced by this entity</returns>
		protected override List<IEntity> GetDependingRelatedEntities()
		{
			List<IEntity> toReturn = new List<IEntity>();
			return toReturn;
		}
		
		/// <summary> Gets a collection of related entities referenced by this entity which this entity depends on (this entity is the FK side of their PK fields). These entities will have to be persisted before this entity during a recursive save.</summary>
		/// <returns>Collection with 0 or more IEntity objects, referenced by this entity</returns>
		protected override List<IEntity> GetDependentRelatedEntities()
		{
			List<IEntity> toReturn = new List<IEntity>();
			if(_htmltoolaccount!=null)
			{
				toReturn.Add(_htmltoolaccount);
			}
			if(_htmltoolcategoryrule!=null)
			{
				toReturn.Add(_htmltoolcategoryrule);
			}
			if(_htmltoolstyle!=null)
			{
				toReturn.Add(_htmltoolstyle);
			}
			if(_htmltooltrademarksetting!=null)
			{
				toReturn.Add(_htmltooltrademarksetting);
			}
			if(_titlesetting!=null)
			{
				toReturn.Add(_titlesetting);
			}
			return toReturn;
		}
		
		/// <summary> Gets a List of all entity collections stored as member variables in this entity. Only 1:n related collections are returned.</summary>
		/// <returns>Collection with 0 or more IEntityCollection objects, referenced by this entity</returns>
		protected override List<IEntityCollection> GetMemberEntityCollections()
		{
			List<IEntityCollection> toReturn = new List<IEntityCollection>();


			return toReturn;
		}


		/// <summary> Fetches the contents of this entity from the persistent storage using the primary key.</summary>
		/// <param name="id">PK value for Productgroup which data should be fetched into this Productgroup object</param>
		/// <returns>True if succeeded, false otherwise.</returns>
		public bool FetchUsingPK(System.Int32 id)
		{
			return FetchUsingPK(id, null, null, null);
		}

		/// <summary> Fetches the contents of this entity from the persistent storage using the primary key.</summary>
		/// <param name="id">PK value for Productgroup which data should be fetched into this Productgroup object</param>
		/// <param name="prefetchPathToUse">the PrefetchPath which defines the graph of objects to fetch as well</param>
		/// <returns>True if succeeded, false otherwise.</returns>
		public bool FetchUsingPK(System.Int32 id, IPrefetchPath prefetchPathToUse)
		{
			return FetchUsingPK(id, prefetchPathToUse, null, null);
		}

		/// <summary> Fetches the contents of this entity from the persistent storage using the primary key.</summary>
		/// <param name="id">PK value for Productgroup which data should be fetched into this Productgroup object</param>
		/// <param name="prefetchPathToUse">the PrefetchPath which defines the graph of objects to fetch as well</param>
		/// <param name="contextToUse">The context to add the entity to if the fetch was succesful. </param>
		/// <returns>True if succeeded, false otherwise.</returns>
		public bool FetchUsingPK(System.Int32 id, IPrefetchPath prefetchPathToUse, Context contextToUse)
		{
			return FetchUsingPK(id, prefetchPathToUse, contextToUse, null);
		}

		/// <summary> Fetches the contents of this entity from the persistent storage using the primary key.</summary>
		/// <param name="id">PK value for Productgroup which data should be fetched into this Productgroup object</param>
		/// <param name="prefetchPathToUse">the PrefetchPath which defines the graph of objects to fetch as well</param>
		/// <param name="contextToUse">The context to add the entity to if the fetch was succesful. </param>
		/// <param name="excludedIncludedFields">The list of IEntityField objects which have to be excluded or included for the fetch. 
		/// If null or empty, all fields are fetched (default). If an instance of ExcludeIncludeFieldsList is passed in and its ExcludeContainedFields property
		/// is set to false, the fields contained in excludedIncludedFields are kept in the query, the rest of the fields in the query are excluded.</param>
		/// <returns>True if succeeded, false otherwise.</returns>
		public bool FetchUsingPK(System.Int32 id, IPrefetchPath prefetchPathToUse, Context contextToUse, ExcludeIncludeFieldsList excludedIncludedFields)
		{
			return Fetch(id, prefetchPathToUse, contextToUse, excludedIncludedFields);
		}

		/// <summary> Refetches the Entity from the persistent storage. Refetch is used to re-load an Entity which is marked "Out-of-sync", due to a save action. Refetching an empty Entity has no effect. </summary>
		/// <returns>true if Refetch succeeded, false otherwise</returns>
		public override bool Refetch()
		{
			return Fetch(this.Id, null, null, null);
		}


				
		/// <summary>Gets a list of all the EntityRelation objects the type of this instance has.</summary>
		/// <returns>A list of all the EntityRelation objects the type of this instance has. Hierarchy relations are excluded.</returns>
		protected override List<IEntityRelation> GetAllRelations()
		{
			return new ProductgroupRelations().GetAllRelations();
		}

		/// <summary> Retrieves the related entity of type 'HtmltoolaccountEntity', using a relation of type 'n:1'</summary>
		/// <returns>A fetched entity of type 'HtmltoolaccountEntity' which is related to this entity.</returns>
		public HtmltoolaccountEntity GetSingleHtmltoolaccount()
		{
			return GetSingleHtmltoolaccount(false);
		}

		/// <summary> Retrieves the related entity of type 'HtmltoolaccountEntity', using a relation of type 'n:1'</summary>
		/// <param name="forceFetch">if true, it will discard any changes currently in the currently loaded related entity and will refetch the entity from the persistent storage</param>
		/// <returns>A fetched entity of type 'HtmltoolaccountEntity' which is related to this entity.</returns>
		public virtual HtmltoolaccountEntity GetSingleHtmltoolaccount(bool forceFetch)
		{
			if( ( !_alreadyFetchedHtmltoolaccount || forceFetch || _alwaysFetchHtmltoolaccount) && !this.IsSerializing && !this.IsDeserializing  && !this.InDesignMode)			
			{
				bool performLazyLoading = this.CheckIfLazyLoadingShouldOccur(Relations.HtmltoolaccountEntityUsingAccountid);
				HtmltoolaccountEntity newEntity = new HtmltoolaccountEntity();
				bool fetchResult = false;
				if(performLazyLoading)
				{
					AddToTransactionIfNecessary(newEntity);
					fetchResult = newEntity.FetchUsingPK(this.Accountid.GetValueOrDefault());
				}
				if(fetchResult)
				{
					newEntity = (HtmltoolaccountEntity)GetFromActiveContext(newEntity);
				}
				else
				{
					if(!_htmltoolaccountReturnsNewIfNotFound)
					{
						RemoveFromTransactionIfNecessary(newEntity);
						newEntity = null;
					}
				}
				this.Htmltoolaccount = newEntity;
				_alreadyFetchedHtmltoolaccount = fetchResult;
			}
			return _htmltoolaccount;
		}


		/// <summary> Retrieves the related entity of type 'HtmltoolcategoryruleEntity', using a relation of type 'n:1'</summary>
		/// <returns>A fetched entity of type 'HtmltoolcategoryruleEntity' which is related to this entity.</returns>
		public HtmltoolcategoryruleEntity GetSingleHtmltoolcategoryrule()
		{
			return GetSingleHtmltoolcategoryrule(false);
		}

		/// <summary> Retrieves the related entity of type 'HtmltoolcategoryruleEntity', using a relation of type 'n:1'</summary>
		/// <param name="forceFetch">if true, it will discard any changes currently in the currently loaded related entity and will refetch the entity from the persistent storage</param>
		/// <returns>A fetched entity of type 'HtmltoolcategoryruleEntity' which is related to this entity.</returns>
		public virtual HtmltoolcategoryruleEntity GetSingleHtmltoolcategoryrule(bool forceFetch)
		{
			if( ( !_alreadyFetchedHtmltoolcategoryrule || forceFetch || _alwaysFetchHtmltoolcategoryrule) && !this.IsSerializing && !this.IsDeserializing  && !this.InDesignMode)			
			{
				bool performLazyLoading = this.CheckIfLazyLoadingShouldOccur(Relations.HtmltoolcategoryruleEntityUsingCategoryruleid);
				HtmltoolcategoryruleEntity newEntity = new HtmltoolcategoryruleEntity();
				bool fetchResult = false;
				if(performLazyLoading)
				{
					AddToTransactionIfNecessary(newEntity);
					fetchResult = newEntity.FetchUsingPK(this.Categoryruleid.GetValueOrDefault());
				}
				if(fetchResult)
				{
					newEntity = (HtmltoolcategoryruleEntity)GetFromActiveContext(newEntity);
				}
				else
				{
					if(!_htmltoolcategoryruleReturnsNewIfNotFound)
					{
						RemoveFromTransactionIfNecessary(newEntity);
						newEntity = null;
					}
				}
				this.Htmltoolcategoryrule = newEntity;
				_alreadyFetchedHtmltoolcategoryrule = fetchResult;
			}
			return _htmltoolcategoryrule;
		}


		/// <summary> Retrieves the related entity of type 'HtmltoolstyleEntity', using a relation of type 'n:1'</summary>
		/// <returns>A fetched entity of type 'HtmltoolstyleEntity' which is related to this entity.</returns>
		public HtmltoolstyleEntity GetSingleHtmltoolstyle()
		{
			return GetSingleHtmltoolstyle(false);
		}

		/// <summary> Retrieves the related entity of type 'HtmltoolstyleEntity', using a relation of type 'n:1'</summary>
		/// <param name="forceFetch">if true, it will discard any changes currently in the currently loaded related entity and will refetch the entity from the persistent storage</param>
		/// <returns>A fetched entity of type 'HtmltoolstyleEntity' which is related to this entity.</returns>
		public virtual HtmltoolstyleEntity GetSingleHtmltoolstyle(bool forceFetch)
		{
			if( ( !_alreadyFetchedHtmltoolstyle || forceFetch || _alwaysFetchHtmltoolstyle) && !this.IsSerializing && !this.IsDeserializing  && !this.InDesignMode)			
			{
				bool performLazyLoading = this.CheckIfLazyLoadingShouldOccur(Relations.HtmltoolstyleEntityUsingStyleid);
				HtmltoolstyleEntity newEntity = new HtmltoolstyleEntity();
				bool fetchResult = false;
				if(performLazyLoading)
				{
					AddToTransactionIfNecessary(newEntity);
					fetchResult = newEntity.FetchUsingPK(this.Styleid.GetValueOrDefault());
				}
				if(fetchResult)
				{
					newEntity = (HtmltoolstyleEntity)GetFromActiveContext(newEntity);
				}
				else
				{
					if(!_htmltoolstyleReturnsNewIfNotFound)
					{
						RemoveFromTransactionIfNecessary(newEntity);
						newEntity = null;
					}
				}
				this.Htmltoolstyle = newEntity;
				_alreadyFetchedHtmltoolstyle = fetchResult;
			}
			return _htmltoolstyle;
		}


		/// <summary> Retrieves the related entity of type 'HtmltooltrademarksettingEntity', using a relation of type 'n:1'</summary>
		/// <returns>A fetched entity of type 'HtmltooltrademarksettingEntity' which is related to this entity.</returns>
		public HtmltooltrademarksettingEntity GetSingleHtmltooltrademarksetting()
		{
			return GetSingleHtmltooltrademarksetting(false);
		}

		/// <summary> Retrieves the related entity of type 'HtmltooltrademarksettingEntity', using a relation of type 'n:1'</summary>
		/// <param name="forceFetch">if true, it will discard any changes currently in the currently loaded related entity and will refetch the entity from the persistent storage</param>
		/// <returns>A fetched entity of type 'HtmltooltrademarksettingEntity' which is related to this entity.</returns>
		public virtual HtmltooltrademarksettingEntity GetSingleHtmltooltrademarksetting(bool forceFetch)
		{
			if( ( !_alreadyFetchedHtmltooltrademarksetting || forceFetch || _alwaysFetchHtmltooltrademarksetting) && !this.IsSerializing && !this.IsDeserializing  && !this.InDesignMode)			
			{
				bool performLazyLoading = this.CheckIfLazyLoadingShouldOccur(Relations.HtmltooltrademarksettingEntityUsingTrademarkid);
				HtmltooltrademarksettingEntity newEntity = new HtmltooltrademarksettingEntity();
				bool fetchResult = false;
				if(performLazyLoading)
				{
					AddToTransactionIfNecessary(newEntity);
					fetchResult = newEntity.FetchUsingPK(this.Trademarkid.GetValueOrDefault());
				}
				if(fetchResult)
				{
					newEntity = (HtmltooltrademarksettingEntity)GetFromActiveContext(newEntity);
				}
				else
				{
					if(!_htmltooltrademarksettingReturnsNewIfNotFound)
					{
						RemoveFromTransactionIfNecessary(newEntity);
						newEntity = null;
					}
				}
				this.Htmltooltrademarksetting = newEntity;
				_alreadyFetchedHtmltooltrademarksetting = fetchResult;
			}
			return _htmltooltrademarksetting;
		}


		/// <summary> Retrieves the related entity of type 'TitlesettingEntity', using a relation of type 'n:1'</summary>
		/// <returns>A fetched entity of type 'TitlesettingEntity' which is related to this entity.</returns>
		public TitlesettingEntity GetSingleTitlesetting()
		{
			return GetSingleTitlesetting(false);
		}

		/// <summary> Retrieves the related entity of type 'TitlesettingEntity', using a relation of type 'n:1'</summary>
		/// <param name="forceFetch">if true, it will discard any changes currently in the currently loaded related entity and will refetch the entity from the persistent storage</param>
		/// <returns>A fetched entity of type 'TitlesettingEntity' which is related to this entity.</returns>
		public virtual TitlesettingEntity GetSingleTitlesetting(bool forceFetch)
		{
			if( ( !_alreadyFetchedTitlesetting || forceFetch || _alwaysFetchTitlesetting) && !this.IsSerializing && !this.IsDeserializing  && !this.InDesignMode)			
			{
				bool performLazyLoading = this.CheckIfLazyLoadingShouldOccur(Relations.TitlesettingEntityUsingColorid);
				TitlesettingEntity newEntity = new TitlesettingEntity();
				bool fetchResult = false;
				if(performLazyLoading)
				{
					AddToTransactionIfNecessary(newEntity);
					fetchResult = newEntity.FetchUsingPK(this.Colorid.GetValueOrDefault());
				}
				if(fetchResult)
				{
					newEntity = (TitlesettingEntity)GetFromActiveContext(newEntity);
				}
				else
				{
					if(!_titlesettingReturnsNewIfNotFound)
					{
						RemoveFromTransactionIfNecessary(newEntity);
						newEntity = null;
					}
				}
				this.Titlesetting = newEntity;
				_alreadyFetchedTitlesetting = fetchResult;
			}
			return _titlesetting;
		}


		/// <summary>Gets all related data objects, stored by name. The name is the field name mapped onto the relation for that particular data element.</summary>
		/// <returns>Dictionary with per name the related referenced data element, which can be an entity collection or an entity or null</returns>
		protected override Dictionary<string, object> GetRelatedData()
		{
			Dictionary<string, object> toReturn = new Dictionary<string, object>();
			toReturn.Add("Htmltoolaccount", _htmltoolaccount);
			toReturn.Add("Htmltoolcategoryrule", _htmltoolcategoryrule);
			toReturn.Add("Htmltoolstyle", _htmltoolstyle);
			toReturn.Add("Htmltooltrademarksetting", _htmltooltrademarksetting);
			toReturn.Add("Titlesetting", _titlesetting);
			return toReturn;
		}
	
		/// <summary> Initializes the class with empty data, as if it is a new Entity.</summary>
		/// <param name="validatorToUse">Validator to use.</param>
		private void InitClassEmpty(IValidator validatorToUse)
		{
			OnInitializing();
			this.Fields = CreateFields();
			this.Validator = validatorToUse;
			InitClassMembers();

			// __LLBLGENPRO_USER_CODE_REGION_START InitClassEmpty
			// __LLBLGENPRO_USER_CODE_REGION_END

			OnInitialized();
		}		

		/// <summary> Initializes the the entity and fetches the data related to the entity in this entity.</summary>
		/// <param name="id">PK value for Productgroup which data should be fetched into this Productgroup object</param>
		/// <param name="validator">The validator object for this ProductgroupEntity</param>
		/// <param name="prefetchPathToUse">the PrefetchPath which defines the graph of objects to fetch as well</param>
		private void InitClassFetch(System.Int32 id, IValidator validator, IPrefetchPath prefetchPathToUse)
		{
			OnInitializing();
			this.Validator = validator;
			this.Fields = CreateFields();
			InitClassMembers();	
			Fetch(id, prefetchPathToUse, null, null);

			// __LLBLGENPRO_USER_CODE_REGION_START InitClassFetch
			// __LLBLGENPRO_USER_CODE_REGION_END

			OnInitialized();
		}

		/// <summary> Initializes the class members</summary>
		private void InitClassMembers()
		{
			_htmltoolaccountReturnsNewIfNotFound = false;
			_htmltoolcategoryruleReturnsNewIfNotFound = false;
			_htmltoolstyleReturnsNewIfNotFound = false;
			_htmltooltrademarksettingReturnsNewIfNotFound = false;
			_titlesettingReturnsNewIfNotFound = false;
			PerformDependencyInjection();

			// __LLBLGENPRO_USER_CODE_REGION_START InitClassMembers
			// __LLBLGENPRO_USER_CODE_REGION_END
			OnInitClassMembersComplete();
		}

		#region Custom Property Hashtable Setup
		/// <summary> Initializes the hashtables for the entity type and entity field custom properties. </summary>
		private static void SetupCustomPropertyHashtables()
		{
			_customProperties = new Dictionary<string, string>();
			_fieldsCustomProperties = new Dictionary<string, Dictionary<string, string>>();
			Dictionary<string, string> fieldHashtable;
			fieldHashtable = new Dictionary<string, string>();
			_fieldsCustomProperties.Add("Accountid", fieldHashtable);
			fieldHashtable = new Dictionary<string, string>();
			_fieldsCustomProperties.Add("Brand", fieldHashtable);
			fieldHashtable = new Dictionary<string, string>();
			_fieldsCustomProperties.Add("Categoryruleid", fieldHashtable);
			fieldHashtable = new Dictionary<string, string>();
			_fieldsCustomProperties.Add("Color", fieldHashtable);
			fieldHashtable = new Dictionary<string, string>();
			_fieldsCustomProperties.Add("Colorid", fieldHashtable);
			fieldHashtable = new Dictionary<string, string>();
			_fieldsCustomProperties.Add("Comment", fieldHashtable);
			fieldHashtable = new Dictionary<string, string>();
			_fieldsCustomProperties.Add("Description", fieldHashtable);
			fieldHashtable = new Dictionary<string, string>();
			_fieldsCustomProperties.Add("Englishtitle", fieldHashtable);
			fieldHashtable = new Dictionary<string, string>();
			_fieldsCustomProperties.Add("Id", fieldHashtable);
			fieldHashtable = new Dictionary<string, string>();
			_fieldsCustomProperties.Add("Itemno", fieldHashtable);
			fieldHashtable = new Dictionary<string, string>();
			_fieldsCustomProperties.Add("Market", fieldHashtable);
			fieldHashtable = new Dictionary<string, string>();
			_fieldsCustomProperties.Add("Material", fieldHashtable);
			fieldHashtable = new Dictionary<string, string>();
			_fieldsCustomProperties.Add("Picurl1", fieldHashtable);
			fieldHashtable = new Dictionary<string, string>();
			_fieldsCustomProperties.Add("Picurl10", fieldHashtable);
			fieldHashtable = new Dictionary<string, string>();
			_fieldsCustomProperties.Add("Picurl11", fieldHashtable);
			fieldHashtable = new Dictionary<string, string>();
			_fieldsCustomProperties.Add("Picurl12", fieldHashtable);
			fieldHashtable = new Dictionary<string, string>();
			_fieldsCustomProperties.Add("Picurl2", fieldHashtable);
			fieldHashtable = new Dictionary<string, string>();
			_fieldsCustomProperties.Add("Picurl3", fieldHashtable);
			fieldHashtable = new Dictionary<string, string>();
			_fieldsCustomProperties.Add("Picurl4", fieldHashtable);
			fieldHashtable = new Dictionary<string, string>();
			_fieldsCustomProperties.Add("Picurl5", fieldHashtable);
			fieldHashtable = new Dictionary<string, string>();
			_fieldsCustomProperties.Add("Picurl6", fieldHashtable);
			fieldHashtable = new Dictionary<string, string>();
			_fieldsCustomProperties.Add("Picurl7", fieldHashtable);
			fieldHashtable = new Dictionary<string, string>();
			_fieldsCustomProperties.Add("Picurl8", fieldHashtable);
			fieldHashtable = new Dictionary<string, string>();
			_fieldsCustomProperties.Add("Picurl9", fieldHashtable);
			fieldHashtable = new Dictionary<string, string>();
			_fieldsCustomProperties.Add("Productcode", fieldHashtable);
			fieldHashtable = new Dictionary<string, string>();
			_fieldsCustomProperties.Add("Productname", fieldHashtable);
			fieldHashtable = new Dictionary<string, string>();
			_fieldsCustomProperties.Add("Quantity", fieldHashtable);
			fieldHashtable = new Dictionary<string, string>();
			_fieldsCustomProperties.Add("Retailprice", fieldHashtable);
			fieldHashtable = new Dictionary<string, string>();
			_fieldsCustomProperties.Add("Size", fieldHashtable);
			fieldHashtable = new Dictionary<string, string>();
			_fieldsCustomProperties.Add("Sizetable", fieldHashtable);
			fieldHashtable = new Dictionary<string, string>();
			_fieldsCustomProperties.Add("Sourceid", fieldHashtable);
			fieldHashtable = new Dictionary<string, string>();
			_fieldsCustomProperties.Add("Specifics", fieldHashtable);
			fieldHashtable = new Dictionary<string, string>();
			_fieldsCustomProperties.Add("Styleid", fieldHashtable);
			fieldHashtable = new Dictionary<string, string>();
			_fieldsCustomProperties.Add("Tag", fieldHashtable);
			fieldHashtable = new Dictionary<string, string>();
			_fieldsCustomProperties.Add("Templateid", fieldHashtable);
			fieldHashtable = new Dictionary<string, string>();
			_fieldsCustomProperties.Add("Trademarkid", fieldHashtable);
		}
		#endregion

		/// <summary> Removes the sync logic for member _htmltoolaccount</summary>
		/// <param name="signalRelatedEntity">If set to true, it will call the related entity's UnsetRelatedEntity method</param>
		/// <param name="resetFKFields">if set to true it will also reset the FK fields pointing to the related entity</param>
		private void DesetupSyncHtmltoolaccount(bool signalRelatedEntity, bool resetFKFields)
		{
			this.PerformDesetupSyncRelatedEntity( _htmltoolaccount, new PropertyChangedEventHandler( OnHtmltoolaccountPropertyChanged ), "Htmltoolaccount", NetDon.eBoss.Data.RelationClasses.StaticProductgroupRelations.HtmltoolaccountEntityUsingAccountidStatic, true, signalRelatedEntity, "Productgroup", resetFKFields, new int[] { (int)ProductgroupFieldIndex.Accountid } );		
			_htmltoolaccount = null;
		}
		
		/// <summary> setups the sync logic for member _htmltoolaccount</summary>
		/// <param name="relatedEntity">Instance to set as the related entity of type entityType</param>
		private void SetupSyncHtmltoolaccount(IEntity relatedEntity)
		{
			if(_htmltoolaccount!=relatedEntity)
			{		
				DesetupSyncHtmltoolaccount(true, true);
				_htmltoolaccount = (HtmltoolaccountEntity)relatedEntity;
				this.PerformSetupSyncRelatedEntity( _htmltoolaccount, new PropertyChangedEventHandler( OnHtmltoolaccountPropertyChanged ), "Htmltoolaccount", NetDon.eBoss.Data.RelationClasses.StaticProductgroupRelations.HtmltoolaccountEntityUsingAccountidStatic, true, ref _alreadyFetchedHtmltoolaccount, new string[] {  } );
			}
		}

		/// <summary>Handles property change events of properties in a related entity.</summary>
		/// <param name="sender"></param>
		/// <param name="e"></param>
		private void OnHtmltoolaccountPropertyChanged( object sender, PropertyChangedEventArgs e )
		{
			switch( e.PropertyName )
			{
				default:
					break;
			}
		}

		/// <summary> Removes the sync logic for member _htmltoolcategoryrule</summary>
		/// <param name="signalRelatedEntity">If set to true, it will call the related entity's UnsetRelatedEntity method</param>
		/// <param name="resetFKFields">if set to true it will also reset the FK fields pointing to the related entity</param>
		private void DesetupSyncHtmltoolcategoryrule(bool signalRelatedEntity, bool resetFKFields)
		{
			this.PerformDesetupSyncRelatedEntity( _htmltoolcategoryrule, new PropertyChangedEventHandler( OnHtmltoolcategoryrulePropertyChanged ), "Htmltoolcategoryrule", NetDon.eBoss.Data.RelationClasses.StaticProductgroupRelations.HtmltoolcategoryruleEntityUsingCategoryruleidStatic, true, signalRelatedEntity, "Productgroup", resetFKFields, new int[] { (int)ProductgroupFieldIndex.Categoryruleid } );		
			_htmltoolcategoryrule = null;
		}
		
		/// <summary> setups the sync logic for member _htmltoolcategoryrule</summary>
		/// <param name="relatedEntity">Instance to set as the related entity of type entityType</param>
		private void SetupSyncHtmltoolcategoryrule(IEntity relatedEntity)
		{
			if(_htmltoolcategoryrule!=relatedEntity)
			{		
				DesetupSyncHtmltoolcategoryrule(true, true);
				_htmltoolcategoryrule = (HtmltoolcategoryruleEntity)relatedEntity;
				this.PerformSetupSyncRelatedEntity( _htmltoolcategoryrule, new PropertyChangedEventHandler( OnHtmltoolcategoryrulePropertyChanged ), "Htmltoolcategoryrule", NetDon.eBoss.Data.RelationClasses.StaticProductgroupRelations.HtmltoolcategoryruleEntityUsingCategoryruleidStatic, true, ref _alreadyFetchedHtmltoolcategoryrule, new string[] {  } );
			}
		}

		/// <summary>Handles property change events of properties in a related entity.</summary>
		/// <param name="sender"></param>
		/// <param name="e"></param>
		private void OnHtmltoolcategoryrulePropertyChanged( object sender, PropertyChangedEventArgs e )
		{
			switch( e.PropertyName )
			{
				default:
					break;
			}
		}

		/// <summary> Removes the sync logic for member _htmltoolstyle</summary>
		/// <param name="signalRelatedEntity">If set to true, it will call the related entity's UnsetRelatedEntity method</param>
		/// <param name="resetFKFields">if set to true it will also reset the FK fields pointing to the related entity</param>
		private void DesetupSyncHtmltoolstyle(bool signalRelatedEntity, bool resetFKFields)
		{
			this.PerformDesetupSyncRelatedEntity( _htmltoolstyle, new PropertyChangedEventHandler( OnHtmltoolstylePropertyChanged ), "Htmltoolstyle", NetDon.eBoss.Data.RelationClasses.StaticProductgroupRelations.HtmltoolstyleEntityUsingStyleidStatic, true, signalRelatedEntity, "Productgroup", resetFKFields, new int[] { (int)ProductgroupFieldIndex.Styleid } );		
			_htmltoolstyle = null;
		}
		
		/// <summary> setups the sync logic for member _htmltoolstyle</summary>
		/// <param name="relatedEntity">Instance to set as the related entity of type entityType</param>
		private void SetupSyncHtmltoolstyle(IEntity relatedEntity)
		{
			if(_htmltoolstyle!=relatedEntity)
			{		
				DesetupSyncHtmltoolstyle(true, true);
				_htmltoolstyle = (HtmltoolstyleEntity)relatedEntity;
				this.PerformSetupSyncRelatedEntity( _htmltoolstyle, new PropertyChangedEventHandler( OnHtmltoolstylePropertyChanged ), "Htmltoolstyle", NetDon.eBoss.Data.RelationClasses.StaticProductgroupRelations.HtmltoolstyleEntityUsingStyleidStatic, true, ref _alreadyFetchedHtmltoolstyle, new string[] {  } );
			}
		}

		/// <summary>Handles property change events of properties in a related entity.</summary>
		/// <param name="sender"></param>
		/// <param name="e"></param>
		private void OnHtmltoolstylePropertyChanged( object sender, PropertyChangedEventArgs e )
		{
			switch( e.PropertyName )
			{
				default:
					break;
			}
		}

		/// <summary> Removes the sync logic for member _htmltooltrademarksetting</summary>
		/// <param name="signalRelatedEntity">If set to true, it will call the related entity's UnsetRelatedEntity method</param>
		/// <param name="resetFKFields">if set to true it will also reset the FK fields pointing to the related entity</param>
		private void DesetupSyncHtmltooltrademarksetting(bool signalRelatedEntity, bool resetFKFields)
		{
			this.PerformDesetupSyncRelatedEntity( _htmltooltrademarksetting, new PropertyChangedEventHandler( OnHtmltooltrademarksettingPropertyChanged ), "Htmltooltrademarksetting", NetDon.eBoss.Data.RelationClasses.StaticProductgroupRelations.HtmltooltrademarksettingEntityUsingTrademarkidStatic, true, signalRelatedEntity, "Productgroup", resetFKFields, new int[] { (int)ProductgroupFieldIndex.Trademarkid } );		
			_htmltooltrademarksetting = null;
		}
		
		/// <summary> setups the sync logic for member _htmltooltrademarksetting</summary>
		/// <param name="relatedEntity">Instance to set as the related entity of type entityType</param>
		private void SetupSyncHtmltooltrademarksetting(IEntity relatedEntity)
		{
			if(_htmltooltrademarksetting!=relatedEntity)
			{		
				DesetupSyncHtmltooltrademarksetting(true, true);
				_htmltooltrademarksetting = (HtmltooltrademarksettingEntity)relatedEntity;
				this.PerformSetupSyncRelatedEntity( _htmltooltrademarksetting, new PropertyChangedEventHandler( OnHtmltooltrademarksettingPropertyChanged ), "Htmltooltrademarksetting", NetDon.eBoss.Data.RelationClasses.StaticProductgroupRelations.HtmltooltrademarksettingEntityUsingTrademarkidStatic, true, ref _alreadyFetchedHtmltooltrademarksetting, new string[] {  } );
			}
		}

		/// <summary>Handles property change events of properties in a related entity.</summary>
		/// <param name="sender"></param>
		/// <param name="e"></param>
		private void OnHtmltooltrademarksettingPropertyChanged( object sender, PropertyChangedEventArgs e )
		{
			switch( e.PropertyName )
			{
				default:
					break;
			}
		}

		/// <summary> Removes the sync logic for member _titlesetting</summary>
		/// <param name="signalRelatedEntity">If set to true, it will call the related entity's UnsetRelatedEntity method</param>
		/// <param name="resetFKFields">if set to true it will also reset the FK fields pointing to the related entity</param>
		private void DesetupSyncTitlesetting(bool signalRelatedEntity, bool resetFKFields)
		{
			this.PerformDesetupSyncRelatedEntity( _titlesetting, new PropertyChangedEventHandler( OnTitlesettingPropertyChanged ), "Titlesetting", NetDon.eBoss.Data.RelationClasses.StaticProductgroupRelations.TitlesettingEntityUsingColoridStatic, true, signalRelatedEntity, "Productgroup", resetFKFields, new int[] { (int)ProductgroupFieldIndex.Colorid } );		
			_titlesetting = null;
		}
		
		/// <summary> setups the sync logic for member _titlesetting</summary>
		/// <param name="relatedEntity">Instance to set as the related entity of type entityType</param>
		private void SetupSyncTitlesetting(IEntity relatedEntity)
		{
			if(_titlesetting!=relatedEntity)
			{		
				DesetupSyncTitlesetting(true, true);
				_titlesetting = (TitlesettingEntity)relatedEntity;
				this.PerformSetupSyncRelatedEntity( _titlesetting, new PropertyChangedEventHandler( OnTitlesettingPropertyChanged ), "Titlesetting", NetDon.eBoss.Data.RelationClasses.StaticProductgroupRelations.TitlesettingEntityUsingColoridStatic, true, ref _alreadyFetchedTitlesetting, new string[] {  } );
			}
		}

		/// <summary>Handles property change events of properties in a related entity.</summary>
		/// <param name="sender"></param>
		/// <param name="e"></param>
		private void OnTitlesettingPropertyChanged( object sender, PropertyChangedEventArgs e )
		{
			switch( e.PropertyName )
			{
				default:
					break;
			}
		}

		/// <summary> Fetches the entity from the persistent storage. Fetch simply reads the entity into an EntityFields object. </summary>
		/// <param name="id">PK value for Productgroup which data should be fetched into this Productgroup object</param>
		/// <param name="prefetchPathToUse">the PrefetchPath which defines the graph of objects to fetch as well</param>
		/// <param name="contextToUse">The context to add the entity to if the fetch was succesful. </param>
		/// <param name="excludedIncludedFields">The list of IEntityField objects which have to be excluded or included for the fetch. 
		/// If null or empty, all fields are fetched (default). If an instance of ExcludeIncludeFieldsList is passed in and its ExcludeContainedFields property
		/// is set to false, the fields contained in excludedIncludedFields are kept in the query, the rest of the fields in the query are excluded.</param>
		/// <returns>True if succeeded, false otherwise.</returns>
		private bool Fetch(System.Int32 id, IPrefetchPath prefetchPathToUse, Context contextToUse, ExcludeIncludeFieldsList excludedIncludedFields)
		{
			try
			{
				OnFetch();
				this.Fields[(int)ProductgroupFieldIndex.Id].ForcedCurrentValueWrite(id);
				CreateDAOInstance().FetchExisting(this, this.Transaction, prefetchPathToUse, contextToUse, excludedIncludedFields);
				return (this.Fields.State == EntityState.Fetched);
			}
			finally
			{
				OnFetchComplete();
			}
		}

		/// <summary> Creates the DAO instance for this type</summary>
		/// <returns></returns>
		protected override IDao CreateDAOInstance()
		{
			return DAOFactory.CreateProductgroupDAO();
		}
		
		/// <summary> Creates the entity factory for this type.</summary>
		/// <returns></returns>
		protected override IEntityFactory CreateEntityFactory()
		{
			return new ProductgroupEntityFactory();
		}

		#region Class Property Declarations
		/// <summary> The relations object holding all relations of this entity with other entity classes.</summary>
		public  static ProductgroupRelations Relations
		{
			get	{ return new ProductgroupRelations(); }
		}
		
		/// <summary> The custom properties for this entity type.</summary>
		/// <remarks>The data returned from this property should be considered read-only: it is not thread safe to alter this data at runtime.</remarks>
		public  static Dictionary<string, string> CustomProperties
		{
			get { return _customProperties;}
		}

		/// <summary> Creates a new PrefetchPathElement object which contains all the information to prefetch the related entities of type 'Htmltoolaccount'  for this entity.</summary>
		/// <returns>Ready to use IPrefetchPathElement implementation.</returns>
		public static IPrefetchPathElement PrefetchPathHtmltoolaccount
		{
			get	{ return new PrefetchPathElement(new NetDon.eBoss.Data.CollectionClasses.HtmltoolaccountCollection(), (IEntityRelation)GetRelationsForField("Htmltoolaccount")[0], (int)NetDon.eBoss.Data.EntityType.ProductgroupEntity, (int)NetDon.eBoss.Data.EntityType.HtmltoolaccountEntity, 0, null, null, null, "Htmltoolaccount", SD.LLBLGen.Pro.ORMSupportClasses.RelationType.ManyToOne); }
		}

		/// <summary> Creates a new PrefetchPathElement object which contains all the information to prefetch the related entities of type 'Htmltoolcategoryrule'  for this entity.</summary>
		/// <returns>Ready to use IPrefetchPathElement implementation.</returns>
		public static IPrefetchPathElement PrefetchPathHtmltoolcategoryrule
		{
			get	{ return new PrefetchPathElement(new NetDon.eBoss.Data.CollectionClasses.HtmltoolcategoryruleCollection(), (IEntityRelation)GetRelationsForField("Htmltoolcategoryrule")[0], (int)NetDon.eBoss.Data.EntityType.ProductgroupEntity, (int)NetDon.eBoss.Data.EntityType.HtmltoolcategoryruleEntity, 0, null, null, null, "Htmltoolcategoryrule", SD.LLBLGen.Pro.ORMSupportClasses.RelationType.ManyToOne); }
		}

		/// <summary> Creates a new PrefetchPathElement object which contains all the information to prefetch the related entities of type 'Htmltoolstyle'  for this entity.</summary>
		/// <returns>Ready to use IPrefetchPathElement implementation.</returns>
		public static IPrefetchPathElement PrefetchPathHtmltoolstyle
		{
			get	{ return new PrefetchPathElement(new NetDon.eBoss.Data.CollectionClasses.HtmltoolstyleCollection(), (IEntityRelation)GetRelationsForField("Htmltoolstyle")[0], (int)NetDon.eBoss.Data.EntityType.ProductgroupEntity, (int)NetDon.eBoss.Data.EntityType.HtmltoolstyleEntity, 0, null, null, null, "Htmltoolstyle", SD.LLBLGen.Pro.ORMSupportClasses.RelationType.ManyToOne); }
		}

		/// <summary> Creates a new PrefetchPathElement object which contains all the information to prefetch the related entities of type 'Htmltooltrademarksetting'  for this entity.</summary>
		/// <returns>Ready to use IPrefetchPathElement implementation.</returns>
		public static IPrefetchPathElement PrefetchPathHtmltooltrademarksetting
		{
			get	{ return new PrefetchPathElement(new NetDon.eBoss.Data.CollectionClasses.HtmltooltrademarksettingCollection(), (IEntityRelation)GetRelationsForField("Htmltooltrademarksetting")[0], (int)NetDon.eBoss.Data.EntityType.ProductgroupEntity, (int)NetDon.eBoss.Data.EntityType.HtmltooltrademarksettingEntity, 0, null, null, null, "Htmltooltrademarksetting", SD.LLBLGen.Pro.ORMSupportClasses.RelationType.ManyToOne); }
		}

		/// <summary> Creates a new PrefetchPathElement object which contains all the information to prefetch the related entities of type 'Titlesetting'  for this entity.</summary>
		/// <returns>Ready to use IPrefetchPathElement implementation.</returns>
		public static IPrefetchPathElement PrefetchPathTitlesetting
		{
			get	{ return new PrefetchPathElement(new NetDon.eBoss.Data.CollectionClasses.TitlesettingCollection(), (IEntityRelation)GetRelationsForField("Titlesetting")[0], (int)NetDon.eBoss.Data.EntityType.ProductgroupEntity, (int)NetDon.eBoss.Data.EntityType.TitlesettingEntity, 0, null, null, null, "Titlesetting", SD.LLBLGen.Pro.ORMSupportClasses.RelationType.ManyToOne); }
		}

		/// <summary>Returns the full name for this entity, which is important for the DAO to find back persistence info for this entity.</summary>
		[Browsable(false), XmlIgnore]
		protected override string LLBLGenProEntityName
		{
			get { return "ProductgroupEntity";}
		}

		/// <summary> The custom properties for the type of this entity instance.</summary>
		/// <remarks>The data returned from this property should be considered read-only: it is not thread safe to alter this data at runtime.</remarks>
		[Browsable(false), XmlIgnore]
		protected override Dictionary<string, string> CustomPropertiesOfType
		{
			get { return CustomProperties;}
		}

		/// <summary> The custom properties for the fields of this entity type. The returned Hashtable contains per fieldname a hashtable of name-value pairs. </summary>
		/// <remarks>The data returned from this property should be considered read-only: it is not thread safe to alter this data at runtime.</remarks>
		public  static Dictionary<string, Dictionary<string, string>> FieldsCustomProperties
		{
			get { return _fieldsCustomProperties;}
		}

		/// <summary> The custom properties for the fields of the type of this entity instance. The returned Hashtable contains per fieldname a hashtable of name-value pairs. </summary>
		/// <remarks>The data returned from this property should be considered read-only: it is not thread safe to alter this data at runtime.</remarks>
		[Browsable(false), XmlIgnore]
		protected override Dictionary<string, Dictionary<string, string>> FieldsCustomPropertiesOfType
		{
			get { return FieldsCustomProperties;}
		}

		/// <summary> The Accountid property of the Entity Productgroup<br/><br/></summary>
		/// <remarks>Mapped on  table field: "PRODUCTGROUP"."ACCOUNTID"<br/>
		/// Table field type characteristics (type, precision, scale, length): Integer, 0, 0, 0<br/>
		/// Table field behavior characteristics (is nullable, is PK, is identity): true, false, false</remarks>
		public virtual Nullable<System.Int32> Accountid
		{
			get { return (Nullable<System.Int32>)GetValue((int)ProductgroupFieldIndex.Accountid, false); }
			set	{ SetValue((int)ProductgroupFieldIndex.Accountid, value, true); }
		}

		/// <summary> The Brand property of the Entity Productgroup<br/><br/></summary>
		/// <remarks>Mapped on  table field: "PRODUCTGROUP"."BRAND"<br/>
		/// Table field type characteristics (type, precision, scale, length): VarChar, 0, 0, 50<br/>
		/// Table field behavior characteristics (is nullable, is PK, is identity): true, false, false</remarks>
		public virtual System.String Brand
		{
			get { return (System.String)GetValue((int)ProductgroupFieldIndex.Brand, true); }
			set	{ SetValue((int)ProductgroupFieldIndex.Brand, value, true); }
		}

		/// <summary> The Categoryruleid property of the Entity Productgroup<br/><br/></summary>
		/// <remarks>Mapped on  table field: "PRODUCTGROUP"."CATEGORYRULEID"<br/>
		/// Table field type characteristics (type, precision, scale, length): Integer, 0, 0, 0<br/>
		/// Table field behavior characteristics (is nullable, is PK, is identity): true, false, false</remarks>
		public virtual Nullable<System.Int32> Categoryruleid
		{
			get { return (Nullable<System.Int32>)GetValue((int)ProductgroupFieldIndex.Categoryruleid, false); }
			set	{ SetValue((int)ProductgroupFieldIndex.Categoryruleid, value, true); }
		}

		/// <summary> The Color property of the Entity Productgroup<br/><br/></summary>
		/// <remarks>Mapped on  table field: "PRODUCTGROUP"."COLOR"<br/>
		/// Table field type characteristics (type, precision, scale, length): VarChar, 0, 0, 20<br/>
		/// Table field behavior characteristics (is nullable, is PK, is identity): true, false, false</remarks>
		public virtual System.String Color
		{
			get { return (System.String)GetValue((int)ProductgroupFieldIndex.Color, true); }
			set	{ SetValue((int)ProductgroupFieldIndex.Color, value, true); }
		}

		/// <summary> The Colorid property of the Entity Productgroup<br/><br/></summary>
		/// <remarks>Mapped on  table field: "PRODUCTGROUP"."COLORID"<br/>
		/// Table field type characteristics (type, precision, scale, length): Integer, 0, 0, 0<br/>
		/// Table field behavior characteristics (is nullable, is PK, is identity): true, false, false</remarks>
		public virtual Nullable<System.Int32> Colorid
		{
			get { return (Nullable<System.Int32>)GetValue((int)ProductgroupFieldIndex.Colorid, false); }
			set	{ SetValue((int)ProductgroupFieldIndex.Colorid, value, true); }
		}

		/// <summary> The Comment property of the Entity Productgroup<br/><br/></summary>
		/// <remarks>Mapped on  table field: "PRODUCTGROUP"."COMMENT"<br/>
		/// Table field type characteristics (type, precision, scale, length): VarChar, 0, 0, 2000<br/>
		/// Table field behavior characteristics (is nullable, is PK, is identity): true, false, false</remarks>
		public virtual System.String Comment
		{
			get { return (System.String)GetValue((int)ProductgroupFieldIndex.Comment, true); }
			set	{ SetValue((int)ProductgroupFieldIndex.Comment, value, true); }
		}

		/// <summary> The Description property of the Entity Productgroup<br/><br/></summary>
		/// <remarks>Mapped on  table field: "PRODUCTGROUP"."DESCRIPTION"<br/>
		/// Table field type characteristics (type, precision, scale, length): Text, 0, 0, 2147483647<br/>
		/// Table field behavior characteristics (is nullable, is PK, is identity): true, false, false</remarks>
		public virtual System.String Description
		{
			get { return (System.String)GetValue((int)ProductgroupFieldIndex.Description, true); }
			set	{ SetValue((int)ProductgroupFieldIndex.Description, value, true); }
		}

		/// <summary> The Englishtitle property of the Entity Productgroup<br/><br/></summary>
		/// <remarks>Mapped on  table field: "PRODUCTGROUP"."ENGLISHTITLE"<br/>
		/// Table field type characteristics (type, precision, scale, length): VarChar, 0, 0, 255<br/>
		/// Table field behavior characteristics (is nullable, is PK, is identity): true, false, false</remarks>
		public virtual System.String Englishtitle
		{
			get { return (System.String)GetValue((int)ProductgroupFieldIndex.Englishtitle, true); }
			set	{ SetValue((int)ProductgroupFieldIndex.Englishtitle, value, true); }
		}

		/// <summary> The Id property of the Entity Productgroup<br/><br/></summary>
		/// <remarks>Mapped on  table field: "PRODUCTGROUP"."ID"<br/>
		/// Table field type characteristics (type, precision, scale, length): Integer, 0, 0, 0<br/>
		/// Table field behavior characteristics (is nullable, is PK, is identity): false, true, true</remarks>
		public virtual System.Int32 Id
		{
			get { return (System.Int32)GetValue((int)ProductgroupFieldIndex.Id, true); }
			set	{ SetValue((int)ProductgroupFieldIndex.Id, value, true); }
		}

		/// <summary> The Itemno property of the Entity Productgroup<br/><br/></summary>
		/// <remarks>Mapped on  table field: "PRODUCTGROUP"."ITEMNO"<br/>
		/// Table field type characteristics (type, precision, scale, length): VarChar, 0, 0, 50<br/>
		/// Table field behavior characteristics (is nullable, is PK, is identity): false, false, false</remarks>
		public virtual System.String Itemno
		{
			get { return (System.String)GetValue((int)ProductgroupFieldIndex.Itemno, true); }
			set	{ SetValue((int)ProductgroupFieldIndex.Itemno, value, true); }
		}

		/// <summary> The Market property of the Entity Productgroup<br/><br/></summary>
		/// <remarks>Mapped on  table field: "PRODUCTGROUP"."MARKET"<br/>
		/// Table field type characteristics (type, precision, scale, length): VarChar, 0, 0, 20<br/>
		/// Table field behavior characteristics (is nullable, is PK, is identity): true, false, false</remarks>
		public virtual System.String Market
		{
			get { return (System.String)GetValue((int)ProductgroupFieldIndex.Market, true); }
			set	{ SetValue((int)ProductgroupFieldIndex.Market, value, true); }
		}

		/// <summary> The Material property of the Entity Productgroup<br/><br/></summary>
		/// <remarks>Mapped on  table field: "PRODUCTGROUP"."MATERIAL"<br/>
		/// Table field type characteristics (type, precision, scale, length): VarChar, 0, 0, 200<br/>
		/// Table field behavior characteristics (is nullable, is PK, is identity): true, false, false</remarks>
		public virtual System.String Material
		{
			get { return (System.String)GetValue((int)ProductgroupFieldIndex.Material, true); }
			set	{ SetValue((int)ProductgroupFieldIndex.Material, value, true); }
		}

		/// <summary> The Picurl1 property of the Entity Productgroup<br/><br/></summary>
		/// <remarks>Mapped on  table field: "PRODUCTGROUP"."PICURL1"<br/>
		/// Table field type characteristics (type, precision, scale, length): VarChar, 0, 0, 255<br/>
		/// Table field behavior characteristics (is nullable, is PK, is identity): true, false, false</remarks>
		public virtual System.String Picurl1
		{
			get { return (System.String)GetValue((int)ProductgroupFieldIndex.Picurl1, true); }
			set	{ SetValue((int)ProductgroupFieldIndex.Picurl1, value, true); }
		}

		/// <summary> The Picurl10 property of the Entity Productgroup<br/><br/></summary>
		/// <remarks>Mapped on  table field: "PRODUCTGROUP"."PICURL10"<br/>
		/// Table field type characteristics (type, precision, scale, length): VarChar, 0, 0, 255<br/>
		/// Table field behavior characteristics (is nullable, is PK, is identity): true, false, false</remarks>
		public virtual System.String Picurl10
		{
			get { return (System.String)GetValue((int)ProductgroupFieldIndex.Picurl10, true); }
			set	{ SetValue((int)ProductgroupFieldIndex.Picurl10, value, true); }
		}

		/// <summary> The Picurl11 property of the Entity Productgroup<br/><br/></summary>
		/// <remarks>Mapped on  table field: "PRODUCTGROUP"."PICURL11"<br/>
		/// Table field type characteristics (type, precision, scale, length): VarChar, 0, 0, 255<br/>
		/// Table field behavior characteristics (is nullable, is PK, is identity): true, false, false</remarks>
		public virtual System.String Picurl11
		{
			get { return (System.String)GetValue((int)ProductgroupFieldIndex.Picurl11, true); }
			set	{ SetValue((int)ProductgroupFieldIndex.Picurl11, value, true); }
		}

		/// <summary> The Picurl12 property of the Entity Productgroup<br/><br/></summary>
		/// <remarks>Mapped on  table field: "PRODUCTGROUP"."PICURL12"<br/>
		/// Table field type characteristics (type, precision, scale, length): VarChar, 0, 0, 255<br/>
		/// Table field behavior characteristics (is nullable, is PK, is identity): true, false, false</remarks>
		public virtual System.String Picurl12
		{
			get { return (System.String)GetValue((int)ProductgroupFieldIndex.Picurl12, true); }
			set	{ SetValue((int)ProductgroupFieldIndex.Picurl12, value, true); }
		}

		/// <summary> The Picurl2 property of the Entity Productgroup<br/><br/></summary>
		/// <remarks>Mapped on  table field: "PRODUCTGROUP"."PICURL2"<br/>
		/// Table field type characteristics (type, precision, scale, length): VarChar, 0, 0, 255<br/>
		/// Table field behavior characteristics (is nullable, is PK, is identity): true, false, false</remarks>
		public virtual System.String Picurl2
		{
			get { return (System.String)GetValue((int)ProductgroupFieldIndex.Picurl2, true); }
			set	{ SetValue((int)ProductgroupFieldIndex.Picurl2, value, true); }
		}

		/// <summary> The Picurl3 property of the Entity Productgroup<br/><br/></summary>
		/// <remarks>Mapped on  table field: "PRODUCTGROUP"."PICURL3"<br/>
		/// Table field type characteristics (type, precision, scale, length): VarChar, 0, 0, 255<br/>
		/// Table field behavior characteristics (is nullable, is PK, is identity): true, false, false</remarks>
		public virtual System.String Picurl3
		{
			get { return (System.String)GetValue((int)ProductgroupFieldIndex.Picurl3, true); }
			set	{ SetValue((int)ProductgroupFieldIndex.Picurl3, value, true); }
		}

		/// <summary> The Picurl4 property of the Entity Productgroup<br/><br/></summary>
		/// <remarks>Mapped on  table field: "PRODUCTGROUP"."PICURL4"<br/>
		/// Table field type characteristics (type, precision, scale, length): VarChar, 0, 0, 255<br/>
		/// Table field behavior characteristics (is nullable, is PK, is identity): true, false, false</remarks>
		public virtual System.String Picurl4
		{
			get { return (System.String)GetValue((int)ProductgroupFieldIndex.Picurl4, true); }
			set	{ SetValue((int)ProductgroupFieldIndex.Picurl4, value, true); }
		}

		/// <summary> The Picurl5 property of the Entity Productgroup<br/><br/></summary>
		/// <remarks>Mapped on  table field: "PRODUCTGROUP"."PICURL5"<br/>
		/// Table field type characteristics (type, precision, scale, length): VarChar, 0, 0, 255<br/>
		/// Table field behavior characteristics (is nullable, is PK, is identity): true, false, false</remarks>
		public virtual System.String Picurl5
		{
			get { return (System.String)GetValue((int)ProductgroupFieldIndex.Picurl5, true); }
			set	{ SetValue((int)ProductgroupFieldIndex.Picurl5, value, true); }
		}

		/// <summary> The Picurl6 property of the Entity Productgroup<br/><br/></summary>
		/// <remarks>Mapped on  table field: "PRODUCTGROUP"."PICURL6"<br/>
		/// Table field type characteristics (type, precision, scale, length): VarChar, 0, 0, 255<br/>
		/// Table field behavior characteristics (is nullable, is PK, is identity): true, false, false</remarks>
		public virtual System.String Picurl6
		{
			get { return (System.String)GetValue((int)ProductgroupFieldIndex.Picurl6, true); }
			set	{ SetValue((int)ProductgroupFieldIndex.Picurl6, value, true); }
		}

		/// <summary> The Picurl7 property of the Entity Productgroup<br/><br/></summary>
		/// <remarks>Mapped on  table field: "PRODUCTGROUP"."PICURL7"<br/>
		/// Table field type characteristics (type, precision, scale, length): VarChar, 0, 0, 255<br/>
		/// Table field behavior characteristics (is nullable, is PK, is identity): true, false, false</remarks>
		public virtual System.String Picurl7
		{
			get { return (System.String)GetValue((int)ProductgroupFieldIndex.Picurl7, true); }
			set	{ SetValue((int)ProductgroupFieldIndex.Picurl7, value, true); }
		}

		/// <summary> The Picurl8 property of the Entity Productgroup<br/><br/></summary>
		/// <remarks>Mapped on  table field: "PRODUCTGROUP"."PICURL8"<br/>
		/// Table field type characteristics (type, precision, scale, length): VarChar, 0, 0, 255<br/>
		/// Table field behavior characteristics (is nullable, is PK, is identity): true, false, false</remarks>
		public virtual System.String Picurl8
		{
			get { return (System.String)GetValue((int)ProductgroupFieldIndex.Picurl8, true); }
			set	{ SetValue((int)ProductgroupFieldIndex.Picurl8, value, true); }
		}

		/// <summary> The Picurl9 property of the Entity Productgroup<br/><br/></summary>
		/// <remarks>Mapped on  table field: "PRODUCTGROUP"."PICURL9"<br/>
		/// Table field type characteristics (type, precision, scale, length): VarChar, 0, 0, 255<br/>
		/// Table field behavior characteristics (is nullable, is PK, is identity): true, false, false</remarks>
		public virtual System.String Picurl9
		{
			get { return (System.String)GetValue((int)ProductgroupFieldIndex.Picurl9, true); }
			set	{ SetValue((int)ProductgroupFieldIndex.Picurl9, value, true); }
		}

		/// <summary> The Productcode property of the Entity Productgroup<br/><br/></summary>
		/// <remarks>Mapped on  table field: "PRODUCTGROUP"."PRODUCTCODE"<br/>
		/// Table field type characteristics (type, precision, scale, length): VarChar, 0, 0, 50<br/>
		/// Table field behavior characteristics (is nullable, is PK, is identity): false, false, false</remarks>
		public virtual System.String Productcode
		{
			get { return (System.String)GetValue((int)ProductgroupFieldIndex.Productcode, true); }
			set	{ SetValue((int)ProductgroupFieldIndex.Productcode, value, true); }
		}

		/// <summary> The Productname property of the Entity Productgroup<br/><br/></summary>
		/// <remarks>Mapped on  table field: "PRODUCTGROUP"."PRODUCTNAME"<br/>
		/// Table field type characteristics (type, precision, scale, length): VarChar, 0, 0, 200<br/>
		/// Table field behavior characteristics (is nullable, is PK, is identity): false, false, false</remarks>
		public virtual System.String Productname
		{
			get { return (System.String)GetValue((int)ProductgroupFieldIndex.Productname, true); }
			set	{ SetValue((int)ProductgroupFieldIndex.Productname, value, true); }
		}

		/// <summary> The Quantity property of the Entity Productgroup<br/><br/></summary>
		/// <remarks>Mapped on  table field: "PRODUCTGROUP"."QUANTITY"<br/>
		/// Table field type characteristics (type, precision, scale, length): Integer, 0, 0, 0<br/>
		/// Table field behavior characteristics (is nullable, is PK, is identity): true, false, false</remarks>
		public virtual Nullable<System.Int32> Quantity
		{
			get { return (Nullable<System.Int32>)GetValue((int)ProductgroupFieldIndex.Quantity, false); }
			set	{ SetValue((int)ProductgroupFieldIndex.Quantity, value, true); }
		}

		/// <summary> The Retailprice property of the Entity Productgroup<br/><br/></summary>
		/// <remarks>Mapped on  table field: "PRODUCTGROUP"."RETAILPRICE"<br/>
		/// Table field type characteristics (type, precision, scale, length): VarChar, 0, 0, 20<br/>
		/// Table field behavior characteristics (is nullable, is PK, is identity): true, false, false</remarks>
		public virtual System.String Retailprice
		{
			get { return (System.String)GetValue((int)ProductgroupFieldIndex.Retailprice, true); }
			set	{ SetValue((int)ProductgroupFieldIndex.Retailprice, value, true); }
		}

		/// <summary> The Size property of the Entity Productgroup<br/><br/></summary>
		/// <remarks>Mapped on  table field: "PRODUCTGROUP"."SIZE"<br/>
		/// Table field type characteristics (type, precision, scale, length): VarChar, 0, 0, 20<br/>
		/// Table field behavior characteristics (is nullable, is PK, is identity): true, false, false</remarks>
		public virtual System.String Size
		{
			get { return (System.String)GetValue((int)ProductgroupFieldIndex.Size, true); }
			set	{ SetValue((int)ProductgroupFieldIndex.Size, value, true); }
		}

		/// <summary> The Sizetable property of the Entity Productgroup<br/><br/></summary>
		/// <remarks>Mapped on  table field: "PRODUCTGROUP"."SIZETABLE"<br/>
		/// Table field type characteristics (type, precision, scale, length): VarChar, 0, 0, 500<br/>
		/// Table field behavior characteristics (is nullable, is PK, is identity): true, false, false</remarks>
		public virtual System.String Sizetable
		{
			get { return (System.String)GetValue((int)ProductgroupFieldIndex.Sizetable, true); }
			set	{ SetValue((int)ProductgroupFieldIndex.Sizetable, value, true); }
		}

		/// <summary> The Sourceid property of the Entity Productgroup<br/><br/></summary>
		/// <remarks>Mapped on  table field: "PRODUCTGROUP"."SOURCEID"<br/>
		/// Table field type characteristics (type, precision, scale, length): Integer, 0, 0, 0<br/>
		/// Table field behavior characteristics (is nullable, is PK, is identity): true, false, false</remarks>
		public virtual Nullable<System.Int32> Sourceid
		{
			get { return (Nullable<System.Int32>)GetValue((int)ProductgroupFieldIndex.Sourceid, false); }
			set	{ SetValue((int)ProductgroupFieldIndex.Sourceid, value, true); }
		}

		/// <summary> The Specifics property of the Entity Productgroup<br/><br/></summary>
		/// <remarks>Mapped on  table field: "PRODUCTGROUP"."SPECIFICS"<br/>
		/// Table field type characteristics (type, precision, scale, length): VarChar, 0, 0, 200<br/>
		/// Table field behavior characteristics (is nullable, is PK, is identity): true, false, false</remarks>
		public virtual System.String Specifics
		{
			get { return (System.String)GetValue((int)ProductgroupFieldIndex.Specifics, true); }
			set	{ SetValue((int)ProductgroupFieldIndex.Specifics, value, true); }
		}

		/// <summary> The Styleid property of the Entity Productgroup<br/><br/></summary>
		/// <remarks>Mapped on  table field: "PRODUCTGROUP"."STYLEID"<br/>
		/// Table field type characteristics (type, precision, scale, length): Integer, 0, 0, 0<br/>
		/// Table field behavior characteristics (is nullable, is PK, is identity): true, false, false</remarks>
		public virtual Nullable<System.Int32> Styleid
		{
			get { return (Nullable<System.Int32>)GetValue((int)ProductgroupFieldIndex.Styleid, false); }
			set	{ SetValue((int)ProductgroupFieldIndex.Styleid, value, true); }
		}

		/// <summary> The Tag property of the Entity Productgroup<br/><br/></summary>
		/// <remarks>Mapped on  table field: "PRODUCTGROUP"."TAG"<br/>
		/// Table field type characteristics (type, precision, scale, length): Integer, 0, 0, 0<br/>
		/// Table field behavior characteristics (is nullable, is PK, is identity): true, false, false</remarks>
		public virtual Nullable<System.Int32> Tag
		{
			get { return (Nullable<System.Int32>)GetValue((int)ProductgroupFieldIndex.Tag, false); }
			set	{ SetValue((int)ProductgroupFieldIndex.Tag, value, true); }
		}

		/// <summary> The Templateid property of the Entity Productgroup<br/><br/></summary>
		/// <remarks>Mapped on  table field: "PRODUCTGROUP"."TEMPLATEID"<br/>
		/// Table field type characteristics (type, precision, scale, length): Integer, 0, 0, 0<br/>
		/// Table field behavior characteristics (is nullable, is PK, is identity): true, false, false</remarks>
		public virtual Nullable<System.Int32> Templateid
		{
			get { return (Nullable<System.Int32>)GetValue((int)ProductgroupFieldIndex.Templateid, false); }
			set	{ SetValue((int)ProductgroupFieldIndex.Templateid, value, true); }
		}

		/// <summary> The Trademarkid property of the Entity Productgroup<br/><br/></summary>
		/// <remarks>Mapped on  table field: "PRODUCTGROUP"."TRADEMARKID"<br/>
		/// Table field type characteristics (type, precision, scale, length): Integer, 0, 0, 0<br/>
		/// Table field behavior characteristics (is nullable, is PK, is identity): true, false, false</remarks>
		public virtual Nullable<System.Int32> Trademarkid
		{
			get { return (Nullable<System.Int32>)GetValue((int)ProductgroupFieldIndex.Trademarkid, false); }
			set	{ SetValue((int)ProductgroupFieldIndex.Trademarkid, value, true); }
		}


		/// <summary> Gets / sets related entity of type 'HtmltoolaccountEntity'. This property is not visible in databound grids.
		/// Setting this property to a new object will make the load-on-demand feature to stop fetching data from the database, until you set this
		/// property to null. Setting this property to an entity will make sure that FK-PK relations are synchronized when appropriate.<br/><br/>
		/// </summary>
		/// <remarks>This property is added for conveniance, however it is recommeded to use the method 'GetSingleHtmltoolaccount()', because 
		/// this property is rather expensive and a method tells the user to cache the result when it has to be used more than once in the
		/// same scope. The property is marked non-browsable to make it hidden in bound controls, f.e. datagrids.</remarks>
		[Browsable(false)]
		public virtual HtmltoolaccountEntity Htmltoolaccount
		{
			get	{ return GetSingleHtmltoolaccount(false); }
			set 
			{ 
				if(this.IsDeserializing)
				{
					SetupSyncHtmltoolaccount(value);
				}
				else
				{
					SetSingleRelatedEntityNavigator(value, "Productgroup", "Htmltoolaccount", _htmltoolaccount, true); 
				}
			}
		}

		/// <summary> Gets / sets the lazy loading flag for Htmltoolaccount. When set to true, Htmltoolaccount is always refetched from the 
		/// persistent storage. When set to false, the data is only fetched the first time Htmltoolaccount is accessed. You can always execute a forced fetch by calling GetSingleHtmltoolaccount(true).</summary>
		[Browsable(false)]
		public bool AlwaysFetchHtmltoolaccount
		{
			get	{ return _alwaysFetchHtmltoolaccount; }
			set	{ _alwaysFetchHtmltoolaccount = value; }	
		}
				
		/// <summary>Gets / Sets the lazy loading flag if the property Htmltoolaccount already has been fetched. Setting this property to false when Htmltoolaccount has been fetched
		/// will set Htmltoolaccount to null as well. Setting this property to true while Htmltoolaccount hasn't been fetched disables lazy loading for Htmltoolaccount</summary>
		[Browsable(false)]
		public bool AlreadyFetchedHtmltoolaccount
		{
			get { return _alreadyFetchedHtmltoolaccount;}
			set 
			{
				if(_alreadyFetchedHtmltoolaccount && !value)
				{
					this.Htmltoolaccount = null;
				}
				_alreadyFetchedHtmltoolaccount = value;
			}
		}

		/// <summary> Gets / sets the flag for what to do if the related entity available through the property Htmltoolaccount is not found
		/// in the database. When set to true, Htmltoolaccount will return a new entity instance if the related entity is not found, otherwise 
		/// null be returned if the related entity is not found. Default: false.</summary>
		[Browsable(false)]
		public bool HtmltoolaccountReturnsNewIfNotFound
		{
			get	{ return _htmltoolaccountReturnsNewIfNotFound; }
			set { _htmltoolaccountReturnsNewIfNotFound = value; }	
		}

		/// <summary> Gets / sets related entity of type 'HtmltoolcategoryruleEntity'. This property is not visible in databound grids.
		/// Setting this property to a new object will make the load-on-demand feature to stop fetching data from the database, until you set this
		/// property to null. Setting this property to an entity will make sure that FK-PK relations are synchronized when appropriate.<br/><br/>
		/// </summary>
		/// <remarks>This property is added for conveniance, however it is recommeded to use the method 'GetSingleHtmltoolcategoryrule()', because 
		/// this property is rather expensive and a method tells the user to cache the result when it has to be used more than once in the
		/// same scope. The property is marked non-browsable to make it hidden in bound controls, f.e. datagrids.</remarks>
		[Browsable(false)]
		public virtual HtmltoolcategoryruleEntity Htmltoolcategoryrule
		{
			get	{ return GetSingleHtmltoolcategoryrule(false); }
			set 
			{ 
				if(this.IsDeserializing)
				{
					SetupSyncHtmltoolcategoryrule(value);
				}
				else
				{
					SetSingleRelatedEntityNavigator(value, "Productgroup", "Htmltoolcategoryrule", _htmltoolcategoryrule, true); 
				}
			}
		}

		/// <summary> Gets / sets the lazy loading flag for Htmltoolcategoryrule. When set to true, Htmltoolcategoryrule is always refetched from the 
		/// persistent storage. When set to false, the data is only fetched the first time Htmltoolcategoryrule is accessed. You can always execute a forced fetch by calling GetSingleHtmltoolcategoryrule(true).</summary>
		[Browsable(false)]
		public bool AlwaysFetchHtmltoolcategoryrule
		{
			get	{ return _alwaysFetchHtmltoolcategoryrule; }
			set	{ _alwaysFetchHtmltoolcategoryrule = value; }	
		}
				
		/// <summary>Gets / Sets the lazy loading flag if the property Htmltoolcategoryrule already has been fetched. Setting this property to false when Htmltoolcategoryrule has been fetched
		/// will set Htmltoolcategoryrule to null as well. Setting this property to true while Htmltoolcategoryrule hasn't been fetched disables lazy loading for Htmltoolcategoryrule</summary>
		[Browsable(false)]
		public bool AlreadyFetchedHtmltoolcategoryrule
		{
			get { return _alreadyFetchedHtmltoolcategoryrule;}
			set 
			{
				if(_alreadyFetchedHtmltoolcategoryrule && !value)
				{
					this.Htmltoolcategoryrule = null;
				}
				_alreadyFetchedHtmltoolcategoryrule = value;
			}
		}

		/// <summary> Gets / sets the flag for what to do if the related entity available through the property Htmltoolcategoryrule is not found
		/// in the database. When set to true, Htmltoolcategoryrule will return a new entity instance if the related entity is not found, otherwise 
		/// null be returned if the related entity is not found. Default: false.</summary>
		[Browsable(false)]
		public bool HtmltoolcategoryruleReturnsNewIfNotFound
		{
			get	{ return _htmltoolcategoryruleReturnsNewIfNotFound; }
			set { _htmltoolcategoryruleReturnsNewIfNotFound = value; }	
		}

		/// <summary> Gets / sets related entity of type 'HtmltoolstyleEntity'. This property is not visible in databound grids.
		/// Setting this property to a new object will make the load-on-demand feature to stop fetching data from the database, until you set this
		/// property to null. Setting this property to an entity will make sure that FK-PK relations are synchronized when appropriate.<br/><br/>
		/// </summary>
		/// <remarks>This property is added for conveniance, however it is recommeded to use the method 'GetSingleHtmltoolstyle()', because 
		/// this property is rather expensive and a method tells the user to cache the result when it has to be used more than once in the
		/// same scope. The property is marked non-browsable to make it hidden in bound controls, f.e. datagrids.</remarks>
		[Browsable(false)]
		public virtual HtmltoolstyleEntity Htmltoolstyle
		{
			get	{ return GetSingleHtmltoolstyle(false); }
			set 
			{ 
				if(this.IsDeserializing)
				{
					SetupSyncHtmltoolstyle(value);
				}
				else
				{
					SetSingleRelatedEntityNavigator(value, "Productgroup", "Htmltoolstyle", _htmltoolstyle, true); 
				}
			}
		}

		/// <summary> Gets / sets the lazy loading flag for Htmltoolstyle. When set to true, Htmltoolstyle is always refetched from the 
		/// persistent storage. When set to false, the data is only fetched the first time Htmltoolstyle is accessed. You can always execute a forced fetch by calling GetSingleHtmltoolstyle(true).</summary>
		[Browsable(false)]
		public bool AlwaysFetchHtmltoolstyle
		{
			get	{ return _alwaysFetchHtmltoolstyle; }
			set	{ _alwaysFetchHtmltoolstyle = value; }	
		}
				
		/// <summary>Gets / Sets the lazy loading flag if the property Htmltoolstyle already has been fetched. Setting this property to false when Htmltoolstyle has been fetched
		/// will set Htmltoolstyle to null as well. Setting this property to true while Htmltoolstyle hasn't been fetched disables lazy loading for Htmltoolstyle</summary>
		[Browsable(false)]
		public bool AlreadyFetchedHtmltoolstyle
		{
			get { return _alreadyFetchedHtmltoolstyle;}
			set 
			{
				if(_alreadyFetchedHtmltoolstyle && !value)
				{
					this.Htmltoolstyle = null;
				}
				_alreadyFetchedHtmltoolstyle = value;
			}
		}

		/// <summary> Gets / sets the flag for what to do if the related entity available through the property Htmltoolstyle is not found
		/// in the database. When set to true, Htmltoolstyle will return a new entity instance if the related entity is not found, otherwise 
		/// null be returned if the related entity is not found. Default: false.</summary>
		[Browsable(false)]
		public bool HtmltoolstyleReturnsNewIfNotFound
		{
			get	{ return _htmltoolstyleReturnsNewIfNotFound; }
			set { _htmltoolstyleReturnsNewIfNotFound = value; }	
		}

		/// <summary> Gets / sets related entity of type 'HtmltooltrademarksettingEntity'. This property is not visible in databound grids.
		/// Setting this property to a new object will make the load-on-demand feature to stop fetching data from the database, until you set this
		/// property to null. Setting this property to an entity will make sure that FK-PK relations are synchronized when appropriate.<br/><br/>
		/// </summary>
		/// <remarks>This property is added for conveniance, however it is recommeded to use the method 'GetSingleHtmltooltrademarksetting()', because 
		/// this property is rather expensive and a method tells the user to cache the result when it has to be used more than once in the
		/// same scope. The property is marked non-browsable to make it hidden in bound controls, f.e. datagrids.</remarks>
		[Browsable(false)]
		public virtual HtmltooltrademarksettingEntity Htmltooltrademarksetting
		{
			get	{ return GetSingleHtmltooltrademarksetting(false); }
			set 
			{ 
				if(this.IsDeserializing)
				{
					SetupSyncHtmltooltrademarksetting(value);
				}
				else
				{
					SetSingleRelatedEntityNavigator(value, "Productgroup", "Htmltooltrademarksetting", _htmltooltrademarksetting, true); 
				}
			}
		}

		/// <summary> Gets / sets the lazy loading flag for Htmltooltrademarksetting. When set to true, Htmltooltrademarksetting is always refetched from the 
		/// persistent storage. When set to false, the data is only fetched the first time Htmltooltrademarksetting is accessed. You can always execute a forced fetch by calling GetSingleHtmltooltrademarksetting(true).</summary>
		[Browsable(false)]
		public bool AlwaysFetchHtmltooltrademarksetting
		{
			get	{ return _alwaysFetchHtmltooltrademarksetting; }
			set	{ _alwaysFetchHtmltooltrademarksetting = value; }	
		}
				
		/// <summary>Gets / Sets the lazy loading flag if the property Htmltooltrademarksetting already has been fetched. Setting this property to false when Htmltooltrademarksetting has been fetched
		/// will set Htmltooltrademarksetting to null as well. Setting this property to true while Htmltooltrademarksetting hasn't been fetched disables lazy loading for Htmltooltrademarksetting</summary>
		[Browsable(false)]
		public bool AlreadyFetchedHtmltooltrademarksetting
		{
			get { return _alreadyFetchedHtmltooltrademarksetting;}
			set 
			{
				if(_alreadyFetchedHtmltooltrademarksetting && !value)
				{
					this.Htmltooltrademarksetting = null;
				}
				_alreadyFetchedHtmltooltrademarksetting = value;
			}
		}

		/// <summary> Gets / sets the flag for what to do if the related entity available through the property Htmltooltrademarksetting is not found
		/// in the database. When set to true, Htmltooltrademarksetting will return a new entity instance if the related entity is not found, otherwise 
		/// null be returned if the related entity is not found. Default: false.</summary>
		[Browsable(false)]
		public bool HtmltooltrademarksettingReturnsNewIfNotFound
		{
			get	{ return _htmltooltrademarksettingReturnsNewIfNotFound; }
			set { _htmltooltrademarksettingReturnsNewIfNotFound = value; }	
		}

		/// <summary> Gets / sets related entity of type 'TitlesettingEntity'. This property is not visible in databound grids.
		/// Setting this property to a new object will make the load-on-demand feature to stop fetching data from the database, until you set this
		/// property to null. Setting this property to an entity will make sure that FK-PK relations are synchronized when appropriate.<br/><br/>
		/// </summary>
		/// <remarks>This property is added for conveniance, however it is recommeded to use the method 'GetSingleTitlesetting()', because 
		/// this property is rather expensive and a method tells the user to cache the result when it has to be used more than once in the
		/// same scope. The property is marked non-browsable to make it hidden in bound controls, f.e. datagrids.</remarks>
		[Browsable(false)]
		public virtual TitlesettingEntity Titlesetting
		{
			get	{ return GetSingleTitlesetting(false); }
			set 
			{ 
				if(this.IsDeserializing)
				{
					SetupSyncTitlesetting(value);
				}
				else
				{
					SetSingleRelatedEntityNavigator(value, "Productgroup", "Titlesetting", _titlesetting, true); 
				}
			}
		}

		/// <summary> Gets / sets the lazy loading flag for Titlesetting. When set to true, Titlesetting is always refetched from the 
		/// persistent storage. When set to false, the data is only fetched the first time Titlesetting is accessed. You can always execute a forced fetch by calling GetSingleTitlesetting(true).</summary>
		[Browsable(false)]
		public bool AlwaysFetchTitlesetting
		{
			get	{ return _alwaysFetchTitlesetting; }
			set	{ _alwaysFetchTitlesetting = value; }	
		}
				
		/// <summary>Gets / Sets the lazy loading flag if the property Titlesetting already has been fetched. Setting this property to false when Titlesetting has been fetched
		/// will set Titlesetting to null as well. Setting this property to true while Titlesetting hasn't been fetched disables lazy loading for Titlesetting</summary>
		[Browsable(false)]
		public bool AlreadyFetchedTitlesetting
		{
			get { return _alreadyFetchedTitlesetting;}
			set 
			{
				if(_alreadyFetchedTitlesetting && !value)
				{
					this.Titlesetting = null;
				}
				_alreadyFetchedTitlesetting = value;
			}
		}

		/// <summary> Gets / sets the flag for what to do if the related entity available through the property Titlesetting is not found
		/// in the database. When set to true, Titlesetting will return a new entity instance if the related entity is not found, otherwise 
		/// null be returned if the related entity is not found. Default: false.</summary>
		[Browsable(false)]
		public bool TitlesettingReturnsNewIfNotFound
		{
			get	{ return _titlesettingReturnsNewIfNotFound; }
			set { _titlesettingReturnsNewIfNotFound = value; }	
		}


		/// <summary> Gets or sets a value indicating whether this entity is a subtype</summary>
		protected override bool LLBLGenProIsSubType
		{
			get { return false;}
		}

		/// <summary> Gets the type of the hierarchy this entity is in. </summary>
		[System.ComponentModel.Browsable(false), XmlIgnore]
		protected override InheritanceHierarchyType LLBLGenProIsInHierarchyOfType
		{
			get { return InheritanceHierarchyType.None;}
		}
		
		/// <summary>Returns the NetDon.eBoss.Data.EntityType enum value for this entity.</summary>
		[Browsable(false), XmlIgnore]
		protected override int LLBLGenProEntityTypeValue 
		{ 
			get { return (int)NetDon.eBoss.Data.EntityType.ProductgroupEntity; }
		}

		#endregion


		#region Custom Entity code
		
		// __LLBLGENPRO_USER_CODE_REGION_START CustomEntityCode
		// __LLBLGENPRO_USER_CODE_REGION_END
		#endregion

		#region Included code

		#endregion
	}
}
